package com.community.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.community.entity.Specialist;
import com.community.service.ISpecialistService;

@Controller
@RequestMapping("/specialist")
public class SpecialistController {
	
	@Autowired
	private ISpecialistService iSpecialistService;
	
	@RequestMapping()
	public String specialist(ModelMap modelMap){
		
		List<Specialist> specialistList= iSpecialistService.getSpecialistList();
		modelMap.addAttribute("specialistList", specialistList);
		return "/specialist/specialist";
	}
	
	
	@RequestMapping("/detail/{id}")
	public String detail(@PathVariable Long id,ModelMap modelMap){
		Specialist s = iSpecialistService.getSpecialistById(id);
		modelMap.addAttribute("s", s);
		return "/specialist/specialist_detail";
		
	}

}
